<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>UniApp 图片多框框选功能 - UI原型</title>
    <style>
        :root {
            --primary-color: #007AFF;
            --success-color: #00FF88;
            --danger-color: #FF3B30;
            --warning-color: #FF9500;
            --bg-dark: #1a1a1a;
            --bg-secondary: #2c2c2c;
            --text-primary: #ffffff;
            --text-secondary: #8e8e93;
            --border-color: #3a3a3c;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--bg-dark);
            color: var(--text-primary);
            line-height: 1.6;
        }

        .container {
            max-width: 414px;
            margin: 0 auto;
            background: var(--bg-dark);
            min-height: 100vh;
            position: relative;
        }

        /* 导航标签 */
        .nav-tabs {
            display: flex;
            background: var(--bg-secondary);
            border-bottom: 1px solid var(--border-color);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .nav-tab {
            flex: 1;
            padding: 12px 8px;
            text-align: center;
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 14px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .nav-tab.active {
            color: var(--primary-color);
            border-bottom: 2px solid var(--primary-color);
        }

        .nav-tab:hover {
            background: rgba(255, 255, 255, 0.05);
        }

        /* 页面内容 */
        .page {
            display: none;
            min-height: calc(100vh - 60px);
        }

        .page.active {
            display: block;
        }

        /* 图片上传页面 */
        .upload-page {
            padding: 40px 20px;
            text-align: center;
        }

        .upload-title {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 12px;
            color: var(--text-primary);
        }

        .upload-subtitle {
            font-size: 16px;
            color: var(--text-secondary);
            margin-bottom: 40px;
        }

        .upload-area {
            border: 2px dashed var(--border-color);
            border-radius: 12px;
            padding: 60px 20px;
            margin-bottom: 30px;
            background: var(--bg-secondary);
            transition: all 0.3s ease;
        }

        .upload-area:hover {
            border-color: var(--primary-color);
            background: rgba(0, 122, 255, 0.05);
        }

        .upload-icon {
            width: 64px;
            height: 64px;
            margin: 0 auto 20px;
            background: var(--primary-color);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 28px;
        }

        .upload-text {
            font-size: 18px;
            color: var(--text-primary);
            margin-bottom: 8px;
        }

        .upload-hint {
            font-size: 14px;
            color: var(--text-secondary);
        }

        .upload-btn {
            background: var(--primary-color);
            color: white;
            border: none;
            border-radius: 8px;
            padding: 14px 32px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .upload-btn:hover {
            background: #0056b3;
            transform: translateY(-1px);
        }

        /* 框选组件页面 */
        .selector-page {
            position: relative;
            height: 100vh;
            background: var(--bg-dark);
        }

        .image-container {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 80px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .image-placeholder {
            width: 100%;
            max-width: 350px;
            height: 500px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 8px;
            position: relative;
            overflow: hidden;
        }

        .image-placeholder::before {
            content: '示例图片';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: white;
            font-size: 18px;
            font-weight: 500;
        }

        /* 框选框 */
        .selection-box {
            position: absolute;
            border: 2px solid var(--success-color);
            background: rgba(0, 255, 136, 0.1);
            border-radius: 4px;
            cursor: move;
        }

        .selection-box.dragging {
            border-color: var(--primary-color);
            background: rgba(0, 122, 255, 0.2);
            box-shadow: 0 0 20px rgba(0, 122, 255, 0.4);
        }

        .selection-box-1 {
            top: 80px;
            left: 40px;
            width: 120px;
            height: 80px;
        }

        .selection-box-2 {
            top: 200px;
            left: 180px;
            width: 100px;
            height: 100px;
        }

        .selection-box-3 {
            top: 350px;
            left: 60px;
            width: 140px;
            height: 60px;
        }

        /* 删除按钮 */
        .delete-btn {
            position: absolute;
            top: -10px;
            right: -10px;
            width: 24px;
            height: 24px;
            background: var(--danger-color);
            border: 2px solid white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 12px;
            color: white;
            transition: all 0.3s ease;
        }

        .delete-btn:hover {
            transform: scale(1.1);
            background: #d70015;
        }

        /* 底部操作栏 */
        .bottom-toolbar {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 80px;
            background: var(--bg-secondary);
            border-top: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            padding: 0 20px;
            gap: 12px;
        }

        .toolbar-btn {
            flex: 1;
            height: 44px;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn-cancel {
            background: var(--bg-dark);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
        }

        .btn-cancel:hover {
            background: var(--border-color);
        }

        .btn-confirm {
            background: var(--primary-color);
            color: white;
        }

        .btn-confirm:hover {
            background: #0056b3;
        }

        .btn-rotate {
            background: var(--warning-color);
            color: white;
        }

        .btn-rotate:hover {
            background: #cc7a00;
        }

        /* 状态指示器 */
        .status-indicator {
            position: absolute;
            top: 20px;
            left: 20px;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 14px;
            backdrop-filter: blur(10px);
        }

        .status-normal {
            background: rgba(0, 255, 136, 0.2);
            color: var(--success-color);
            border: 1px solid var(--success-color);
        }

        .status-rotated {
            background: rgba(255, 149, 0, 0.2);
            color: var(--warning-color);
            border: 1px solid var(--warning-color);
        }

        .status-dragging {
            background: rgba(0, 122, 255, 0.2);
            color: var(--primary-color);
            border: 1px solid var(--primary-color);
        }

        /* 旋转动画 */
        .rotated {
            transform: rotate(90deg);
            transition: transform 0.5s ease;
        }

        /* 加载状态 */
        .loading-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.8);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(5px);
        }

        .loading-spinner {
            width: 40px;
            height: 40px;
            border: 4px solid rgba(255, 255, 255, 0.3);
            border-top: 4px solid var(--primary-color);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-bottom: 16px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .loading-text {
            color: var(--text-primary);
            font-size: 16px;
        }

        /* 说明文字 */
        .description {
            position: absolute;
            bottom: 100px;
            left: 20px;
            right: 20px;
            background: rgba(0, 0, 0, 0.8);
            padding: 16px;
            border-radius: 8px;
            font-size: 14px;
            color: var(--text-secondary);
            backdrop-filter: blur(10px);
        }

        .description h4 {
            color: var(--text-primary);
            margin-bottom: 8px;
            font-size: 16px;
        }

        .description ul {
            padding-left: 20px;
        }

        .description li {
            margin-bottom: 4px;
        }

        /* 响应式设计 */
        @media (max-width: 414px) {
            .container {
                max-width: 100%;
            }
            
            .nav-tab {
                font-size: 12px;
                padding: 10px 4px;
            }
            
            .upload-page {
                padding: 30px 15px;
            }
            
            .image-placeholder {
                height: 450px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 导航标签 -->
        <nav class="nav-tabs">
            <button class="nav-tab active" onclick="showPage('upload')">图片上传</button>
            <button class="nav-tab" onclick="showPage('normal')">正常状态</button>
            <button class="nav-tab" onclick="showPage('rotated')">旋转状态</button>
            <button class="nav-tab" onclick="showPage('dragging')">拖拽状态</button>
        </nav>

        <!-- 图片上传页面 -->
        <div id="upload" class="page upload-page active">
            <h1 class="upload-title">图片框选工具</h1>
            <p class="upload-subtitle">选择图片开始框选标注</p>
            
            <div class="upload-area">
                <div class="upload-icon">📷</div>
                <div class="upload-text">点击上传图片</div>
                <div class="upload-hint">支持 JPG、PNG、JPEG、WEBP 格式</div>
            </div>
            
            <button class="upload-btn">从相册选择</button>
        </div>

        <!-- 正常状态 - 显示框选框 -->
        <div id="normal" class="page selector-page">
            <div class="status-indicator status-normal">正常状态 - 显示框选框</div>
            
            <div class="image-container">
                <div class="image-placeholder">
                    <!-- 框选框 1 -->
                    <div class="selection-box selection-box-1">
                        <div class="delete-btn">×</div>
                    </div>
                    
                    <!-- 框选框 2 -->
                    <div class="selection-box selection-box-2">
                        <div class="delete-btn">×</div>
                    </div>
                    
                    <!-- 框选框 3 -->
                    <div class="selection-box selection-box-3">
                        <div class="delete-btn">×</div>
                    </div>
                </div>
            </div>
            
            <div class="description">
                <h4>功能说明：</h4>
                <ul>
                    <li>图片按比例撑满容器，居中显示</li>
                    <li>根据传入坐标绘制框选框</li>
                    <li>框选框右上角有删除按钮</li>
                    <li>支持拖拽移动框选框</li>
                </ul>
            </div>
            
            <div class="bottom-toolbar">
                <button class="toolbar-btn btn-cancel">取消</button>
                <button class="toolbar-btn btn-confirm">确定</button>
                <button class="toolbar-btn btn-rotate">旋转</button>
            </div>
        </div>

        <!-- 旋转状态 - 清空框选框 -->
        <div id="rotated" class="page selector-page">
            <div class="status-indicator status-rotated">旋转状态 - 清空框选框</div>
            
            <div class="image-container">
                <div class="image-placeholder rotated">
                    <!-- 旋转状态下无框选框 -->
                </div>
            </div>
            
            <div class="description">
                <h4>旋转功能说明：</h4>
                <ul>
                    <li>图片顺时针旋转90度</li>
                    <li>旋转后清空所有框选框</li>
                    <li>支持连续旋转（0°、90°、180°、270°）</li>
                    <li>回到0°时恢复原始框选框</li>
                </ul>
            </div>
            
            <div class="bottom-toolbar">
                <button class="toolbar-btn btn-cancel">取消</button>
                <button class="toolbar-btn btn-confirm">确定</button>
                <button class="toolbar-btn btn-rotate">旋转</button>
            </div>
        </div>

        <!-- 拖拽状态 - 视觉反馈 -->
        <div id="dragging" class="page selector-page">
            <div class="status-indicator status-dragging">拖拽状态 - 实时反馈</div>
            
            <div class="image-container">
                <div class="image-placeholder">
                    <!-- 正在拖拽的框选框 -->
                    <div class="selection-box selection-box-1 dragging">
                        <div class="delete-btn">×</div>
                    </div>
                    
                    <!-- 普通框选框 -->
                    <div class="selection-box selection-box-2">
                        <div class="delete-btn">×</div>
                    </div>
                    
                    <div class="selection-box selection-box-3">
                        <div class="delete-btn">×</div>
                    </div>
                </div>
            </div>
            
            <div class="description">
                <h4>拖拽功能说明：</h4>
                <ul>
                    <li>拖拽时框选框高亮显示</li>
                    <li>实时更新坐标位置</li>
                    <li>拖拽范围限制在图片内</li>
                    <li>提供视觉反馈和阴影效果</li>
                </ul>
            </div>
            
            <div class="bottom-toolbar">
                <button class="toolbar-btn btn-cancel">取消</button>
                <button class="toolbar-btn btn-confirm">确定</button>
                <button class="toolbar-btn btn-rotate">旋转</button>
            </div>
            
            <!-- 加载状态示例 -->
            <!-- <div class="loading-overlay">
                <div class="loading-spinner"></div>
                <div class="loading-text">处理中...</div>
            </div> -->
        </div>
    </div>

    <script>
        // 页面切换功能
        function showPage(pageId) {
            // 隐藏所有页面
            const pages = document.querySelectorAll('.page');
            pages.forEach(page => page.classList.remove('active'));
            
            // 移除所有标签的active状态
            const tabs = document.querySelectorAll('.nav-tab');
            tabs.forEach(tab => tab.classList.remove('active'));
            
            // 显示指定页面
            document.getElementById(pageId).classList.add('active');
            
            // 激活对应标签
            event.target.classList.add('active');
        }

        // 模拟交互效果（仅用于原型展示）
        document.addEventListener('DOMContentLoaded', function() {
            // 上传按钮点击效果
            const uploadBtn = document.querySelector('.upload-btn');
            if (uploadBtn) {
                uploadBtn.addEventListener('click', function() {
                    alert('这是UI原型，实际功能需要在开发时实现');
                });
            }

            // 框选框删除按钮点击效果
            const deleteBtns = document.querySelectorAll('.delete-btn');
            deleteBtns.forEach(btn => {
                btn.addEventListener('click', function(e) {
                    e.stopPropagation();
                    if (confirm('确定要删除这个框选框吗？')) {
                        btn.parentElement.style.display = 'none';
                    }
                });
            });

            // 底部工具栏按钮点击效果
            const toolbarBtns = document.querySelectorAll('.toolbar-btn');
            toolbarBtns.forEach(btn => {
                btn.addEventListener('click', function() {
                    const action = btn.textContent;
                    alert(`${action}功能 - 这是UI原型，实际功能需要在开发时实现`);
                });
            });
        });
    </script>
</body>
</html>
